<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		*{
			margin: 0;
			padding: 0;
			box-sizing: border-box;
		}
		p{
			width: 100%;
			text-align: center;
		}
		.wai{
			width: 500px;
			height: 300px;
			background: #eee;
			margin: 0 auto;
		}
		.nei{
			width: 100px;
			height: 100px;
			background: #f00;
		}
		.one{
			display: flex;
			justify-content: center;
			align-items: center;
		}
	</style>
</head>
<body>
<p>水平垂直居中</p>
<div class="wai one">
	<div class="nei"></div>
</div>
</body>
</html>